# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import models, migrations
from django.conf import settings
import django.db.models.deletion


class Migration(migrations.Migration):

    dependencies = [
        ('areas', '0001_initial'),
        ('meiduo', '0003_users_email_active'),
    ]

    operations = [
        migrations.CreateModel(
            name='Address',
            fields=[
                ('id', models.AutoField(verbose_name='ID', primary_key=True, serialize=False, auto_created=True)),
                ('create_time', models.DateTimeField(verbose_name='创建时间', auto_now_add=True)),
                ('update_time', models.DateTimeField(verbose_name='更新时间', auto_now=True)),
                ('title', models.CharField(verbose_name='地址名称', max_length=20)),
                ('receiver', models.CharField(verbose_name='收货人', max_length=20)),
                ('place', models.CharField(verbose_name='地址', max_length=50)),
                ('mobile', models.CharField(verbose_name='手机', max_length=11)),
                ('tel', models.CharField(verbose_name='固定电话', max_length=20, blank=True, null=True, default='')),
                ('email', models.CharField(verbose_name='电子邮箱', max_length=30, blank=True, null=True, default='')),
                ('is_deleted', models.BooleanField(verbose_name='逻辑删除', default=False)),
                ('city', models.ForeignKey(verbose_name='市', related_name='city_addresses', on_delete=django.db.models.deletion.PROTECT, to='areas.Area')),
                ('district', models.ForeignKey(verbose_name='区', related_name='district_addresses', on_delete=django.db.models.deletion.PROTECT, to='areas.Area')),
                ('province', models.ForeignKey(verbose_name='省', related_name='province_addresses', on_delete=django.db.models.deletion.PROTECT, to='areas.Area')),
                ('user', models.ForeignKey(verbose_name='用户', related_name='addresses', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'verbose_name': '用户地址',
                'verbose_name_plural': '用户地址',
                'db_table': 'tb_address',
                'ordering': ['-update_time'],
            },
        ),
        migrations.AddField(
            model_name='users',
            name='default_address',
            field=models.ForeignKey(verbose_name='默认地址', blank=True, null=True, related_name='users', on_delete=django.db.models.deletion.SET_NULL, to='meiduo.Address'),
        ),
    ]
